//
//  SubtitleTableViewCell.m
//  UGoods
//
//  Created by dllo on 16/1/20.
//  Copyright © 2016年 蓝鸥科技.李贺. All rights reserved.
//

#import "SubtitleTableViewCell.h"
#import "FindModel.h"
#import "BaseLabel.h"
#import "BaseView.h"
#import "ConstantsDefine.h"
@interface SubtitleTableViewCell ()

@property (nonatomic, retain) UIImageView *imageView1;
@property (nonatomic, retain) UIImageView *imageView2;
@property (nonatomic, retain) UIImageView *imageView3;
@property (nonatomic, retain) BaseLabel *subtitleLabel;
@property (nonatomic, retain) BaseView *backView;

@end

@implementation SubtitleTableViewCell

- (void)dealloc
{
    [_imageView1 release];
    [_imageView2 release];
    [_imageView3 release];
    [_subtitleLabel release];
    [_backView release];
    [_model release];
    [super dealloc];
}

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.backView = [[BaseView alloc] init];
        [self.contentView addSubview:_backView];
        [_backView release];
        
        self.imageView1 = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"iconfont-guanzhuliubianxing"]];
        [self.contentView addSubview:_imageView1];
        [_imageView1 release];
        
        self.imageView2 = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"iconfont-guanzhuliubianxing-3"]];
        [self.contentView addSubview:_imageView2];
        [_imageView2 release];
        
        self.imageView3 = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"iconfont-guanzhuliubianxing-3"]];
        [self.contentView addSubview:_imageView3];
        [_imageView3 release];
        
        self.subtitleLabel = [[BaseLabel alloc] init];
        _subtitleLabel.textColor = [UIColor blackColor];
        _subtitleLabel.font = [UIFont systemFontOfSize:13 * WIDTH];
//        _subtitleLabel.numberOfLines = 0;
        [self.backView addSubview:_subtitleLabel];
        [_subtitleLabel release];
    }
    return self;
}

- (void)layoutSubviews {
    [super layoutSubviews];
    _backView.frame = CGRectMake(0, 0, self.contentView.frame.size.width, self.contentView.frame.size.height);
    _imageView1.frame = CGRectMake(10 * WIDTH, 10 * HEIGHT, 15 * WIDTH, 15 * HEIGHT);
    _imageView2.frame = CGRectMake(self.contentView.frame.size.width - 45 * WIDTH, 10 * HEIGHT, 15 * WIDTH, 15 * HEIGHT);
    _imageView3.frame = CGRectMake(self.contentView.frame.size.width - 25 * WIDTH, 10 * HEIGHT, 15 * WIDTH, 15 * HEIGHT);
    _subtitleLabel.frame = CGRectMake(30 * WIDTH, 10 * HEIGHT, self.contentView.frame.size.width - 80 * WIDTH, 15 * HEIGHT);
}

- (void)setModel:(FindModel *)model {
    if (_model != model) {
        [_model release];
        _model = [model retain];
    }
    _subtitleLabel.text = model.content;
    
}

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
